package com.atguigu.jxc.service.impl;

import com.atguigu.jxc.dao.SaleListDao;
import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.domain.SuccessCode;
import com.atguigu.jxc.entity.SaleList;
import com.atguigu.jxc.entity.SaleListGoods;
import com.atguigu.jxc.service.SaleListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * description
 *
 * @author SZ
 * @date 2022/9/26/8:50
 */
@Service
public class SaleListServiceImpl implements SaleListService {
    @Autowired
    private SaleListDao saleListDao;
    @Override
    public void save(SaleList saleList) {
        saleListDao.save(saleList);
    }

    @Override
    public List<SaleListGoods> getList(String saleNumber, Integer customerId, Integer state, String sTime, String eTime) {
        return saleListDao.getList(saleNumber,customerId,state,sTime,eTime);
    }

    @Override
    public ServiceVO delete(Integer saleListId) {
        if (saleListId!=null){
            saleListDao.deleteById(saleListId);
            return new ServiceVO (SuccessCode.SUCCESS_CODE,SuccessCode.SUCCESS_MESS);
        }
        return null;
    }
}
